package nc.tb.cube.ass;

import java.util.Iterator;
import java.util.Map;

import nc.tb.pub.util.NtbLogger;

public class Formula {
	public double getResult(Map paramMap, String formula) {
		double result = 0.00;
		for (Iterator it = paramMap.entrySet().iterator(); it.hasNext();) {
			Map.Entry e = (Map.Entry) it.next();
			String key = (String) e.getKey();
			String value = (String) e.getValue();
			formula = formula.replaceAll(key, value);
			NtbLogger.print4("key: " + e.getKey());
			NtbLogger.print4("value: " + e.getValue());
		}
		FormulaParser formulaparser = new FormulaParser(formula);
		result = formulaparser.getResult();
		return result;
	}

}
